<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const arr = [
        { name: '你', age: 38 },
        { name: 'Tony', age: 22 },
        { name: 'Peter', age: 56 },
      ]

      //   const students = arr.findIndex((stu) => {
      //     return (stu.name = 'Peter' && stu.age > 50)
      //   })
      //   console.log(students)

      const sortStu = arr.sort(function (a, b) {
        return a.age - b.age
      })
      console.table(sortStu)
    </script>
  </body>
</html>
